package com.horizon.cloud.center.zuul.config;

import com.horizon.cloud.common.constants.SessionConstants;
import com.horizon.cloud.standard.filter.OptionsRequestFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.FilterRegistration;
import java.nio.file.attribute.FileTime;
import java.util.logging.Filter;

@Configuration
public class OptionsRequestFilterConfig {
    @Bean
    public FilterRegistrationBean buldOptionsRequestFilter() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setOrder(SessionConstants.OPTIONS_REQUEST_ORDER);
        filterRegistrationBean.setFilter(new OptionsRequestFilter());
        filterRegistrationBean.setName("optionsRequestFilter" );
        filterRegistrationBean.addUrlPatterns("/*" );
        return filterRegistrationBean;
    }
}
